//    Copyright (C) Kherty.  All rights reserved.
namespace OpenLS.Spreadsheet.Extensibility
{
    public class TreatArrayValueColumnAsDoubleArrayAttribute: ParameterConverterAttribute
    {
        internal override void ConvertImp(ConversionData data)
        {
            if (data.TargetType == typeof(double[]))
            {
                if (data.Value is IArray)
                {
                    IArray v = (IArray)data.Value;
                    double[] result = new double[v.ColumnCount];
                    for (int i = 0; i < result.Length; i++)
                        result[i] = (double)v[0, i];
                    data.Result = result;
                }
            }
        }
    }
}